package org.example.leetcode;

import java.util.Stack;

/**
 * @author: lynn
 * @Descript:
 * @date: 2021/8/5 20:38
 * @version: 1.0
 */
public class LC334 {
    public static void main(String[] args) {
        LC334 lc=new LC334();
        int[] nums={20,100,10,12,5,13};
        System.out.println(lc.increasingTriplet(nums));

    }
    public boolean increasingTriplet(int[] nums) {
        if (nums.length<3) return false;
        int start=0;
        int end=nums.length;
        Boolean leftFlag=false,rightFlag=false;
        for (int mid = start+1; mid <end-1 ; mid++) {
            for (int i=start;i<mid;i++){
                leftFlag=false;
                if (nums[i]<nums[mid]){
                    leftFlag=true;
                    break;
                }
            }
            if (leftFlag){// 前面为true 后面才有意义
                for (int i=mid+1;i<end;i++) {
                    rightFlag=false;
                    if (nums[mid] < nums[i]) {
                        rightFlag=true;
                        break;
                    }
                }

            }
            if (leftFlag&&rightFlag) return true;
        }
        return false;
    }
}
